﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace XimalayaAudioDownloader
{
	// Token: 0x02000004 RID: 4
	internal class DataGridViewProgressBarCell : DataGridViewCell
	{
		// Token: 0x06000050 RID: 80 RVA: 0x000033E7 File Offset: 0x000015E7
		public DataGridViewProgressBarCell()
		{
			this.ValueType = typeof(int);
		}

		// Token: 0x06000051 RID: 81 RVA: 0x0000340D File Offset: 0x0000160D
		public DataGridViewProgressBarCell(Color progressBarColor)
		{
			this.ProgressBarColor = progressBarColor;
		}

		// Token: 0x06000052 RID: 82 RVA: 0x0000342C File Offset: 0x0000162C
		protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
		{
			using (SolidBrush solidBrush = new SolidBrush(cellStyle.BackColor))
			{
				graphics.FillRectangle(solidBrush, cellBounds);
			}
			base.PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);
			using (SolidBrush solidBrush2 = new SolidBrush(this.ProgressBarColor))
			{
				bool flag = value == null;
				if (flag)
				{
					value = 0;
				}
				int num = (int)value;
				float num2 = (float)num / 100f;
				graphics.FillRectangle(solidBrush2, (float)cellBounds.X, (float)(cellBounds.Y + 1), (float)cellBounds.Width * num2, (float)(cellBounds.Height - 3));
				string text = string.Format("{0}%", num);
				SizeF sizeF = graphics.MeasureString(text, cellStyle.Font);
				float x = (float)cellBounds.X + ((float)cellBounds.Width - sizeF.Width) / 2f;
				float y = (float)cellBounds.Y + ((float)cellBounds.Height - sizeF.Height) / 2f;
				graphics.DrawString(text, cellStyle.Font, new SolidBrush(cellStyle.ForeColor), x, y);
			}
		}

		// Token: 0x04000021 RID: 33
		protected Color ProgressBarColor = Color.MediumTurquoise;
	}
}
